package pe.com.slcsccy.aegis.model.dao;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import pe.com.slcsccy.aegis.model.beans.Agencia;
import pe.com.slcsccy.aegis.model.beans.AgenciaExample;

import com.ibatis.sqlmap.client.SqlMapClient;

@Repository("agenciaDAO")
public class AgenciaDAOImpl extends SqlMapClientDaoSupport implements AgenciaDAO {

    /**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table agencia
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public AgenciaDAOImpl() {
		super();
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table agencia
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public int countByExample(AgenciaExample example) {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject(
				"agencia.ibatorgenerated_countByExample", example);
		return count;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table agencia
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public int deleteByExample(AgenciaExample example) {
		int rows = getSqlMapClientTemplate().delete(
				"agencia.ibatorgenerated_deleteByExample", example);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table agencia
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public int deleteByPrimaryKey(Long idAgencia) {
		Agencia key = new Agencia();
		key.setIdAgencia(idAgencia);
		int rows = getSqlMapClientTemplate().delete(
				"agencia.ibatorgenerated_deleteByPrimaryKey", key);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table agencia
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public void insert(Agencia record) {
		getSqlMapClientTemplate().insert("agencia.ibatorgenerated_insert",
				record);
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table agencia
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public void insertSelective(Agencia record) {
		getSqlMapClientTemplate().insert(
				"agencia.ibatorgenerated_insertSelective", record);
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table agencia
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	@SuppressWarnings("unchecked")
	public List<Agencia> selectByExample(AgenciaExample example) {
		List<Agencia> list = getSqlMapClientTemplate().queryForList(
				"agencia.ibatorgenerated_selectByExample", example);
		return list;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table agencia
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public Agencia selectByPrimaryKey(Long idAgencia) {
		Agencia key = new Agencia();
		key.setIdAgencia(idAgencia);
		Agencia record = (Agencia) getSqlMapClientTemplate().queryForObject(
				"agencia.ibatorgenerated_selectByPrimaryKey", key);
		return record;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table agencia
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public int updateByExampleSelective(Agencia record, AgenciaExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate().update(
				"agencia.ibatorgenerated_updateByExampleSelective", parms);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table agencia
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public int updateByExample(Agencia record, AgenciaExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate().update(
				"agencia.ibatorgenerated_updateByExample", parms);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table agencia
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public int updateByPrimaryKeySelective(Agencia record) {
		int rows = getSqlMapClientTemplate().update(
				"agencia.ibatorgenerated_updateByPrimaryKeySelective", record);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table agencia
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	public int updateByPrimaryKey(Agencia record) {
		int rows = getSqlMapClientTemplate().update(
				"agencia.ibatorgenerated_updateByPrimaryKey", record);
		return rows;
	}

	/**
	 * This class was generated by Apache iBATIS ibator. This class corresponds to the database table agencia
	 * @ibatorgenerated  Sat May 19 03:00:51 COT 2012
	 */
	private static class UpdateByExampleParms extends AgenciaExample {
		private Object record;

		public UpdateByExampleParms(Object record, AgenciaExample example) {
			super(example);
			this.record = record;
		}

		public Object getRecord() {
			return record;
		}
	}

	@Autowired
    public void createSqlMapClient(@Qualifier("sqlMapClient")  SqlMapClient sqlMapClient){
      setSqlMapClient(sqlMapClient);
    }   
}